home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / ASTRONOM / H139.ZIP / UI101.ZIP / IO / UI / UI.H < prev    next >
C/C++ Source or Header  |  1991-11-04  |  10KB  |  241 lines

  1. /***************************************************************
  2.  
  3.     ui.h            Header file for User Interface
  4.             implementation
  5.  
  6.             Copyright (c) 1991, Ted A. Campbell
  7.  
  8.             Bywater Software
  9.             P. O. Box 4023 
  10.             Duke Station 
  11.             Durham, NC  27706
  12.  
  13.             email: tcamp@hercules.acpub.duke.edu
  14.  
  15.     Copyright and Permissions Information:
  16.  
  17.     All U.S. and international copyrights are claimed by the
  18.     author. The author grants permission to use this code
  19.     and software based on it under the following conditions:
  20.     (a) in general, the code and software based upon it may be 
  21.     used by individuals and by non-profit organizations; (b) it
  22.     may also be utilized by governmental agencies in any country,
  23.     with the exception of military agencies; (c) the code and/or
  24.     software based upon it may not be sold for a profit without
  25.     an explicit and specific permission from the author, except
  26.     that a minimal fee may be charged for media on which it is
  27.     copied, and for copying and handling; (d) the code must be 
  28.     distributed in the form in which it has been released by the
  29.     author; and (e) the code and software based upon it may not 
  30.     be used for illegal activities. 
  31.  
  32. ***************************************************************/
  33.  
  34. /* some ASCII control character constants */
  35.  
  36. #ifndef CR
  37. #define CR      0x0d
  38. #endif
  39.  
  40. #ifndef LF
  41. #define LF      0x0a
  42. #endif
  43.  
  44. #ifndef   ESCAPE
  45. #define   ESCAPE   0x1b
  46. #endif
  47.  
  48. /* user-controllable definitions for toolkit */
  49.  
  50. #define SHADOW_XSIZE    4
  51. #define BORDER_SIZE     2
  52. #define MAXENTRIES      64
  53. #define MAXLENGTH       80
  54. #define TITLE_YMARGIN   1
  55. #define USE_ICONS
  56. #define INC_ACCURACY    50   /* multiply by a larger number for accuracy */
  57. #define DEFAULT_FONT_SIZE 30
  58. #define BWENVARNAME     "BWPATH"        /* name for BW Path Env. variable */
  59. #define UI_MEMERR       "Out of Memory"
  60.  
  61. /* menu types */
  62.  
  63. #define   MENU_PLAIN   0
  64. #define   MENU_TITLED  1
  65. #define   MENU_SLIDERS 2
  66. #define   MENU_ICON    3
  67.  
  68. /* return values */
  69.  
  70. #define TK_ERROR        0xeffe
  71. #define TK_EXIT         0xefff
  72. #define MO_UP           0x501
  73. #define MO_DN           0x502
  74. #define MO_SEL          0x503
  75. #define MO_EXIT         0x505
  76. #define MO_LEFT         0x506
  77. #define MO_RIGHT        0x507
  78. #define MO_SRC          0x508
  79.  
  80. #define EVENT_NULL       0
  81. #define    EVENT_SELECTED   1
  82. #define EVENT_ERROR      0xeffe
  83. #define EVENT_EXIT       0xefff
  84. #define EVENT_SOURCE     2
  85. #define EVENT_CHANGE     3
  86.  
  87. /* Window buttons */
  88.  
  89. #define BUT_CLOSE               1
  90. #define BUT_MOVE                2
  91. #define BUT_RESIZE              4
  92.  
  93.  
  94. struct   uiwindow
  95.    {
  96.    int     x1;             /* left of whole area           */
  97.    int     y1;             /* bottom of whole area         */
  98.    int     x2;             /* right of whole area          */
  99.    int     y2;             /* top of whole area            */
  100.    int     t_flag;         /* is there a title ?           */
  101.    int     t_bcolor;       /* title background color       */
  102.    int     t_tcolor;       /* title text color             */
  103.    int     tbar_x1;        /* left of title bar            */
  104.    int     tbar_y1;        /* bottom of title bar          */
  105.    int     tbar_x2;        /* right of title bar           */
  106.    int     tbar_y2;        /* top of title bar             */
  107.    int     ti_x1;          /* left side of title area    */
  108.    int     ti_y1;          /* bottom of title area       */
  109.    int     ti_x2;          /* right side of title area   */
  110.    int     ti_y2;          /* top of title area          */
  111.    int     s_flag;         /* is there a shadow?           */
  112.    int     s_color;        /* shadow color                 */
  113.    int     b_flag;         /* is there a border ?          */
  114.    int     b_color;        /* border color                 */
  115.    int     m_color;        /* main area color              */
  116.    int     m_style;        /* main area fill style         */
  117.    int     buttons;        /* buttons selected             */
  118.    int     bt_x1;          /* left side of close button    */
  119.    int     bt_y1;          /* bottom of close button       */
  120.    int     bt_x2;          /* right side of close button   */
  121.    int     bt_y2;          /* top of close button          */
  122.    int     re_x1;          /* left side of resize button   */
  123.    int     re_y1;          /* bottom of resize button      */
  124.    int     re_x2;          /* right side of resize button  */
  125.    int     re_y2;          /* top of resize button         */
  126.    int     mv_x1;          /* left side of move button     */
  127.    int     mv_y1;          /* bottom of move button        */
  128.    int     mv_x2;          /* right side of move button    */
  129.    int     mv_y2;          /* top of move button           */
  130.    int     u_x1;           /* left of usable space         */
  131.    int     u_y1;           /* bottom of usable space       */
  132.    int     u_x2;           /* right of usable space        */
  133.    int     u_y2;           /* top of usable space          */
  134.    };
  135.  
  136. struct  menu_box
  137.    {
  138.    struct  uiwindow *window;       /* uiwindow for menu/icon box   */
  139.    int     type;                   /* type of menu                 */
  140.    char    **d_titles;             /* array of titles              */
  141.    struct  dir_ent **d_entries;    /* array of directory entries   */
  142.    int     max_entries;            /* max items in each array      */
  143.    int     is_drawn;               /* is menu/icon box drawn?      */
  144.    int     save_fysize;            /* save font y size             */
  145.    int     save_font;              /* save font type               */
  146.    int     xsize;                  /* x size of single icon space  */
  147.    int     ysize;                  /* y size of single icon space  */
  148.    int     x_items;                /* number of icons on x axis    */
  149.    int     y_items;                /* number of icons on y axis    */
  150.    int     x_logical;              /* logical items on x axis      */
  151.    int     y_logical;              /* logical items on y axis      */
  152.    int     x_pos;                  /* current position, x axis     */
  153.    int     y_pos;                  /* current position, y axis     */
  154.    int     current;                /* currently selected item      */
  155.    int     x_start;                /* starting position for x axis */
  156.    int     y_start;                /* starting position for y axis */
  157.    int     fore;                   /* foreground color             */
  158.    int     back;                   /* background color             */
  159.    int     high;                   /* highlight color              */
  160.    int     number;                 /* total number of icons/menu items */
  161.    int     i_x1;                   /* icon area, left              */
  162.    int     i_y1;                   /* icon area, bottom            */
  163.    int     i_x2;                   /* icon area, right             */
  164.    int     i_y2;                   /* icon area, top               */
  165.    int     vs_x1;                  /* vertical slide, left         */
  166.    int     vs_y1;                  /* vertical slide, bottom       */
  167.    int     vs_x2;                  /* vertical slide, right        */
  168.    int     vs_y2;                  /* vertical slide, top          */
  169.    int     ve_y1;                  /* vertical elevator, bottom    */
  170.    int     ve_y2;                  /* vertical elevator, top       */
  171.    int     hs_x1;                  /* horizontal slide, left       */
  172.    int     hs_y1;                  /* horizontal slide, bottom     */
  173.    int     hs_x2;                  /* horizontal slide, right      */
  174.    int     hs_y2;                  /* horizontal slide, top        */
  175.    int     he_x1;                  /* horizontal elevator, left    */
  176.    int     he_x2;                  /* horizontal elevator, right   */
  177.    int     vel_x1;                 /* vertical elevator left       */
  178.    int     vel_y1;                 /* vertical elevator bottom     */
  179.    int     vel_x2;                 /* vertical elevator right      */
  180.    int     vel_y2;                 /* vertical elevator top        */
  181.    int     vel_inc;                /* vertical elevator increment  */
  182.    int     hel_x1;                 /* horizontal elevator left     */
  183.    int     hel_y1;                 /* horizontal elevator bottom   */
  184.    int     hel_x2;                 /* horizontal elevator right    */
  185.    int     hel_y2;                 /* horizontal elevator top      */
  186.    int     hel_inc;                /* horizontal elevator increment */
  187.    };
  188.  
  189. struct pbm_struct
  190.    {
  191.    int xsize;
  192.    int ysize;
  193.    int image;
  194.    };
  195.  
  196. struct tty_struct
  197.    {
  198.    struct uiwindow *window;     /* pointer to ui window structure */
  199.    int lines;                   /* text lines in window */
  200.    int columns;                 /* text columns in window */
  201.    int font_ysize;              /* font size, vertical */
  202.    int font_xsize;              /* font size, horizontal */
  203.    int curs_xpos;               /* cursor x (column) position */
  204.    int curs_ypos;               /* cursor y (line) position */
  205.    int foreground;              /* text foreground color */
  206.    int background;              /* text background color */
  207.    int standout;                /* boolean: standout? TRUE = reverse video */
  208.    int scroll_right;            /* boolean: scroll at right margin */
  209.                 /* default: FALSE, do not scroll */
  210.    char *cbuffer;               /* buffer to hold character position */
  211.    };                           /* overwritten by cursor */
  212.  
  213. struct ui_twstruct
  214.    {
  215.    struct tw_struct *tw;
  216.    struct uiwindow  *uiw;
  217.    };
  218.  
  219. extern  struct gr_window *ui_grwind;
  220. extern  char   ui_ready;
  221.  
  222. extern  struct uiwindow * ui_window();
  223. extern  struct tty_struct * tty_init();
  224. extern  struct ui_twstruct * ui_twinit();
  225.  
  226. extern  char ui_tbuf[ 128 ];
  227. extern    int  ui_screen;
  228. extern  char   ui_fontpath[ 128 ];
  229.  
  230. extern  struct pbm_struct ui_elicon;         /* elevator icon */
  231. extern  struct pbm_struct ui_lefticn;        /* left icon */
  232. extern  struct pbm_struct ui_righticn;       /* right icon */
  233. extern  struct pbm_struct ui_upicn;          /* up icon */
  234. extern  struct pbm_struct ui_downicn;        /* down icon */
  235. extern  struct pbm_struct ui_clicon;         /* close window icon */
  236. extern  struct pbm_struct ui_reicon;         /* resize window icon */
  237. extern  struct pbm_struct ui_mvicon;         /* move window icon */
  238. extern  struct pbm_struct ui_deficon;        /* default file icon */
  239. extern  struct pbm_struct ui_foldicon;       /* file folder icon */
  240. extern  struct pbm_struct ui_exicon;         /* executable file icon */
  241.